<#-- 徐伟伟： 培训中心公共尾自定义引入需要的js宏  ,下面为引用样例
<#assign selfjs = "
	var a=1;
	alert(a);
"/>
<#import "common/includ_js_css.ftl" as stc_footer>
<@stc_footer.jsurl selfjs=selfjs url=["staticfile/js/common", "staticfile/js/jquery-1.7.2.min", "staticfile/mer/js/busPlatform"]/>
 -->
<#assign ctxPath=request.contextPath>
<#setting number_format="#">
<#macro jsurl  selfjs  url=[] >
<#if url??>
<#list url as js>
<#if !js?contains("~")>
<script type="text/javascript" src="${ctxPath}/staticfile/js/${js}" ></script>
</#if>
</#list>
</#if>
<script type="text/javascript">
$.ajaxSetup ({ 
    cache: false //关闭AJAX相应的缓存 
});
${selfjs}
<#if url??>
$(function(){
loadScript.load([<#list url as js><#if js?contains("~")>"${ctxPath}/staticfile/js/${js?substring(1)}"<#if (js_index+1)==url?size><#else>,</#if></#if></#list>]);
});
</#if>
var loadScript = (function() {
    var loadOne = function (url) {
        var dtd = $.Deferred();
        var node = document.createElement('script');
        node.type = "text/javascript";
        var onload = function(){
            dtd.resolve();
        };
        $(node).load(onload).bind('readystatechange', function(){
            if (node.readyState == 'loaded'){
                onload();
            }
        });
        document.getElementsByTagName('head')[0].appendChild(node);
        node.src = url;
        return dtd.promise();
    };

    var load = function(urls) {
        if(!$.isArray(urls)) {
            return load([urls]);
        }
        var ret = [];
        for (var i = 0; i < urls.length; i++) {
            ret[i] = loadOne(urls[i]);
        };
        return $.when.apply($, ret);
    }

    return {
        load: load
    };
})();
</script>
  </body>
</html>
</#macro>
